package dynamic;

public class SingleLLUtils_1 {
	
	public static int length (Node tail) {
		int i = 0;
			while (tail != null){
				tail = tail.next;
				i = i+1;
			}
		return i;
	}
	
	public static int length (Node tail, int y) {
		int i = 0;
			while (tail != null){
				tail = tail.next;
				i = i+1;
			}
		return i;
	}

	public static int max (Node tail) {
		int i = tail.value;
			while (tail != null){
				//i = i < tail.value ? tail.value : i;
				if(i < tail.value) i = tail.value;
				tail = tail.next;
			}
		return i;
	}

	public static int sum (Node tail) {
		int i = 0;
			while (tail != null){
				i += tail.value;
				tail = tail.next;
			}
		return i;
	}
}
